<template tag="以下文档内容为hycli自动生成">
  <div style="height: 100%">
    <div style="margin:0.8rem;"><h5 style="display:inline">系统信息</h5><span style="margin-left: 0.5rem; color:#999"> </span>
    </div>
    <hr style="margin-top:0;color:#999"/>
<div class="query">
    
    <el-form :model="form_aaarh" inline >
        <!-- 日期控件个数： 0 -->
        <!-- 控件个数：[{"index":7,"raw":"name","name":"name","cname":"Name","type":{"raw":"varchar(32)","name":"varchar","len":32,"dlen":0},"defValue":"","allowNull":false,"constraints":["q","l","le","v","c","u","DN","#like"],"desc":{"raw":"系统名称","name":"系统名称"}}] -->
         <el-form-item>
            <el-input clearable style="width: 180px" v-model="form_aaarh.single_text_value" maxlength="32"
                placeholder="关键字" >
                <template #prepend>
                    <el-select v-model="form_aaarh.single_text_name" placeholder="查询类型" style="width:84px;">
                        <el-option
                        v-for="item in multiQueryText"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                      />
                      </el-select>
                  </template>
            </el-input>
        </el-form-item>

        <span class="ddl">
        </span>
        <el-form-item>
            <el-space wrap>
                <el-button type="primary" icon="Search" @click="onQuery(true)">查询</el-button>
                <el-button :type="$js.page.tagColor(0)"  icon="Plus"  @click="show_cmpnt_aaarl">添加系统</el-button>
            </el-space>
        </el-form-item>
        

        <!-- xtabs -->
        

    </el-form>
</div>
<div>
   <aabea ref="cmpnt_aabea" @onsaved="onQuery"></aabea>
   <aabeb ref="cmpnt_aabeb" @onsaved="onQuery"></aabeb>
   <aabec ref="cmpnt_aabec" @onsaved="onQuery"></aabec>
   <aaasf ref="cmpnt_aaasf" @onsaved="onQuery"></aaasf>
   <aaarl ref="cmpnt_aaarl" @onsaved="onQuery"></aaarl>
   <aaarj ref="cmpnt_aaarj" @onsaved="onQuery"></aaarj>
   <aaark ref="cmpnt_aaark" @onsaved="onQuery"></aaark>
</div>
<div class="list">
    <el-table :data="dataList_aaarh"
    
    v-loading="conf.loading" stripe  style="width: 100%;height:calc(100vh - 160px)"
         empty-text="无数据">le
<el-table-column width="24px" type="expand">
    <template #default="view">
        <el-row :gutter="24">
            <el-col :span="5" class="text-right" style="min-height:26px">系统编号:</el-col>
            <el-col :span="7" v-text="view.row.le_id" style="min-height:26px" ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">LOGO:</el-col>
            <el-col :span="7"  style="min-height:26px"><i :class="view.row.le_logo"></i></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">系统名称:</el-col>
            <el-col :span="7" v-text="view.row.le_name" style="min-height:26px" ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">唯一标识:</el-col>
            <el-col :span="7" v-text="view.row.le_ident" style="min-height:26px" ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">首页地址:</el-col>
            <el-col :span="7" style="min-height:26px"
            >
                <el-link target="_blank" type="primary" :href="view.row.le_index_url" v-if="view.row.le_index_url" :title="view.row.le_index_url">查看</el-link>
            </el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">登录地址:</el-col>
            <el-col :span="7" v-text="view.row.le_login_url" style="min-height:26px" ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">主题样式:</el-col>
            <el-col :span="7" v-text="view.row.le_theme" style="min-height:26px" ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">背景图片:</el-col>
            <el-col :span="7" v-text="view.row.le_bg_url" style="min-height:26px" ></el-col>
            <el-col :span="5" class="text-right" style="min-height:26px">状态:</el-col>
            <el-col :span="7" v-text="view.row.status_label" style="min-height:26px"
              ></el-col>
        </el-row>
    </template>
</el-table-column>
        
        	<!--id text -->
        <el-table-column  show-overflow-tooltip    align="center" label="系统编号" >
            <template #default="scope">
                  <span>{{ scope.row.id||'-' }}</span>
              </template>
        </el-table-column>
        	<!--logo icon -->
        <el-table-column   prop="logo" align="center" label="LOGO">
            <template #default="scope">
                <i :class="scope.row.logo"></i>
            </template>
        </el-table-column>
        	<!--name text -->
        <el-table-column  show-overflow-tooltip    align="center" label="系统名称" >
            <template #default="scope">
                  <span>{{ scope.row.name||'-' }}</span>
              </template>
        </el-table-column>
        	<!--ident text -->
        <el-table-column  show-overflow-tooltip    align="center" label="唯一标识" >
            <template #default="scope">
                  <span>{{ scope.row.ident||'-' }}</span>
              </template>
        </el-table-column>
        	<!--index_url link -->
        <el-table-column     align="center" label="首页地址">
            <template #default="scope">
                <el-link target="_blank" type="success" :href="scope.row.index_url" v-if="scope.row.index_url" :title="scope.row.index_url">查看</el-link>
            </template>
        </el-table-column>
        	<!--login_url text -->
        <el-table-column  show-overflow-tooltip    align="center" label="登录地址" >
            <template #default="scope">
                  <span>{{ scope.row.login_url||'-' }}</span>
              </template>
        </el-table-column>
        	<!--status switch -->
        <el-table-column     align="center" label="状态">
            <template #default="scope">
                <el-switch  @change="onstatusSwitchChange(scope.row,$event)"  v-model="scope.row.status_switch" />
            </template>
        </el-table-column>

<el-table-column fixed="right" align="center" label="操作" width="112">
    <template #default="scope">
        <div class="opts">
            <el-button   type="text" @click="show_cmpnt_aaarj(scope.row)" >详情 </el-button>
            <el-button   type="text" @click="show_cmpnt_aaark(scope.row)" >修改 </el-button>
        </div>
    </template>
</el-table-column>
    </el-table>
    <el-pagination :currentPage="form_aaarh.pi" :page-size="form_aaarh.ps"
        style="position: absolute; right: 30px;bottom:6px;" :page-sizes="[10,15,20,30, 50, 100]" :background="false" small
        layout="total,sizes,prev, pager, next, jumper" :total="total_aaarh" @size-change="handleSizeChange"
        @current-change="handleCurrentChange" />
</div>
  </div>
</template>
<script>
// 添加根节点
import aabea from "@/views/sso/system/system_menu.add"
// 子节
import aabeb from "@/views/sso/system/system_menu.add"
// 编辑
import aabec from "@/views/sso/system/system_menu.edit"
// 删除
import aaasf from "@/views/sso/system/system_menu.cnfrm"
// 添加系统
import aaarl from "@/views/sso/system/system_info.add"
// 详情
import aaarj from "@/views/sso/system/system_info.view"
// 修改
import aaark from "@/views/sso/system/system_info.edit"



export default {
components: {
    aabea,
    aabeb,
    aabec,
    aaasf,
    aaarl,
    aaarj,
    aaark,
},
data() {
  return {
    shortcuts: this.$js.page.latestDays(),
    cmpnt_funcs:{},
    conf: {
      loading: false,
      progressColor: this.$theia.env.conf.progress || []
    },
    ganttIdx: -1,
        form_aaarh: {
            pi: 1,
            ps: 15,
            disabled:false,
            single_date_range_name:"",
            single_date_range_value:[],
            single_text_name:"",
            single_text_value:"",
            name:"",
            },
            statusList:[],
            dataList_aaarh:[],
            multiQueryDateRange:[],
            multiQueryText:[{label:"系统名称",value:"name"},],
            total_aaarh:0,
            note_dataList:[],
};
  },
mounted() {
  this.loadEnums_aaarh()
  this.form_aaarh.single_date_range_name = (this.multiQueryDateRange[0]||{}).value
  this.form_aaarh.single_text_name = (this.multiQueryText[0]||{}).value
  this.cmpnt_funcs["aabea"] = this.show_cmpnt_aabea
  this.cmpnt_funcs["aabeb"] = this.show_cmpnt_aabeb
  this.cmpnt_funcs["aabec"] = this.show_cmpnt_aabec
  this.cmpnt_funcs["aaasf"] = this.show_cmpnt_aaasf
  this.cmpnt_funcs["aaarl"] = this.show_cmpnt_aaarl
  this.cmpnt_funcs["aaarj"] = this.show_cmpnt_aaarj
  this.cmpnt_funcs["aaark"] = this.show_cmpnt_aaark

  this.form_aaarh = Object.assign(this.form_aaarh,this.$route.params)
  this.queryData_aaarh ()
    },
methods: {
  ganttChange(id) {
      this.ganttIdx = id
    },

queryData_aaarh(mform = {},nform={}){
    //构建查询参数
    let queryForm = Object.assign({},this.form_aaarh)
    queryForm = Object.assign(queryForm,nform||{})
    
    //处理多个日期选择
    queryForm[this.form_aaarh.single_date_range_name] = this.form_aaarh.single_date_range_value
    queryForm[this.form_aaarh.single_text_name] = this.form_aaarh.single_text_value
   
    //处理日期范围选择

    queryForm[this.form_aaarh.single_date_range_name] = null
    queryForm.single_date_range_value = null
    queryForm.single_date_range_name = null

    queryForm.single_text_value = null
    queryForm.single_text_name = null
 
    //处理关联表system_info system_info system_info
   
    //发送查询请求
    let that = this
    that.conf.loading = true
    //构建统计查询
  //数据查询
  this.$theia.http.get("/sso/system/info/query",queryForm).then(res=>{
      if((res.items||[]).length < (queryForm.ps||10)){
        that.form_aaarh.disabled = true
      }
      that.conf.loading = false
      that.dataList_aaarh = res.items||[]
      that.total_aaarh = res.count
      that.resetItemData_aaarh(that,that.dataList_aaarh)
    });
  },

  resetItemData_aaarh(that,lst){
    lst.forEach(item => {
      item.__raw = Object.assign({}, item)
    item.status_label = that.$theia.enum.getName("status",item.status)
    item.id_progress = item.id
    item.logo_progress = item.logo
    item.name_progress = item.name
    item.ident_progress = item.ident
    item.index_url_progress = item.index_url
    item.login_url_progress = item.login_url
    item.theme_progress = item.theme
    item.bg_url_progress = item.bg_url
    item.status_switch = item.status == 0
    item.le_id = item.id
    item.le_logo = item.logo
    item.le_name = item.name
    item.le_ident = item.ident
    item.le_index_url = item.index_url
    item.le_login_url = item.login_url
    item.le_theme = item.theme
    item.le_bg_url = item.bg_url
    item.le_status = item.status
    if(item.children){
      that.resetItemData_aaarh(that,item.children)
    }
  });
  },
  onstatusSwitchChange(xfrom,v) {
      let form = {}
      form.status = v == true? 0 : 1;
      form.id = xfrom.id
      let that = this
      this.$theia.http.post("/sso/system/info/switch",form).then(res=>{
        that.$notify.success({title: '成功',message: '修改状态成功',duration:5000})
      }).catch(res=>{
        v = !v
        let code = ((res||{}).response||{}).status||0
        let msg = `修改状态失败(${code})`
        that.$notify.error({title: '失败',message: msg,duration:5000})
      });
  },
    loadEnums_aaarh(){
        //状态
        this.statusList = this.$theia.enum.get("status","","" ,false,"")
    },

  handleSizeChange(ps){
    this.form_aaarh.ps = ps
    this.onQuery(true)
  },
  handleCurrentChange(pi){
    this.form_aaarh.pi = pi
    this.onQuery()
  },
  onQuery(refresh){
    if(refresh){
      this.form_aaarh.pi = 1
    }
    this.queryData_aaarh ()
  },
show_cmpnt(cmd,row){
  if(this.cmpnt_funcs[cmd]){
    this.cmpnt_funcs[cmd](row)
  }
},
  //详情
  show_cmpnt_aaarj(fm = {}){
    let query = {} 
    query.id = fm.id|| fm.le_id 
    query.logo = fm.logo|| fm.le_logo 
    query.name = fm.name|| fm.le_name 
    query.ident = fm.ident|| fm.le_ident 
    query.index_url = fm.index_url|| fm.le_index_url 
    query.login_url = fm.login_url|| fm.le_login_url 
    query.theme = fm.theme|| fm.le_theme 
    query.bg_url = fm.bg_url|| fm.le_bg_url 
    query.status = fm.status|| fm.le_status 
    query.id = fm.id

      //2023.4.18添加---

    query.$title="详情"
    this.$refs.cmpnt_aaarj.show(query)
  },
  //添加系统
  show_cmpnt_aaarl(fm = {}){
    let query = {} 
    query.logo = fm.logo|| fm.le_logo 
    query.name = fm.name|| fm.le_name 
    query.ident = fm.ident|| fm.le_ident 
    query.index_url = fm.index_url|| fm.le_index_url 
    query.login_url = fm.login_url|| fm.le_login_url 
    query.theme = fm.theme|| fm.le_theme 
    query.bg_url = fm.bg_url|| fm.le_bg_url 
    query.status = fm.status|| fm.le_status 
    query.id = fm.id

      //2023.4.18添加---
    query.status = "0"

    query.$title="添加系统"
    this.$refs.cmpnt_aaarl.show(query)
  },
  //修改
  show_cmpnt_aaark(fm = {}){
    let query = {} 
    query.logo = fm.logo|| fm.le_logo 
    query.name = fm.name|| fm.le_name 
    query.ident = fm.ident|| fm.le_ident 
    query.index_url = fm.index_url|| fm.le_index_url 
    query.login_url = fm.login_url|| fm.le_login_url 
    query.theme = fm.theme|| fm.le_theme 
    query.bg_url = fm.bg_url|| fm.le_bg_url 
    query.status = fm.status|| fm.le_status 
    query.id = fm.id

      //2023.4.18添加---

    query.$title="修改"
    this.$refs.cmpnt_aaark.show(query)
  },
},
};
</script>
<style>
.el-dialog{
  border-radius:5px !important
}
</style>
<style scoped>
.el-form-item {
  margin-right: 10px !important;
}

.opts .el-button--small {
  margin-left: 0px;
  padding-left: 0px;
  margin-right: 4px;
}

/deep/.el-table td.el-table__cell div {
  vertical-align: middle;
}
/deep/.el-button+.el-dropdown{
  margin-left:0px;
}
/deep/.el-button+.el-button{
  margin-left:0px;
}
.el-button{
  padding-left: 6px !important;
  padding-right: 6px !important;
}
.blist {
  margin-bottom: 8px;
  width: 100%;
}

.blist .el-radio-group {
  margin-right: 8px;
}

.ddl {
  margin-bottom: 8px;
  width: 100%;

}

.ddl .el-dropdown {
  margin-right: 8px;
}

.listbar {
  margin-bottom: 8px;
  text-align: center;
}
 .el-dropdown-link {
  cursor: pointer;
  color: var(--el-color-primary);
  display: flex;
  align-items: center;
  font-size: 0.65rem;
}
/deep/.el-button--small{
  padding: 5px 4px;
}

.prepend /deep/.el-input__wrapper{
  border-top-right-radius:0;
  border-bottom-right-radius:0;
}
.prepend+/deep/.el-date-editor{
  border-top-left-radius:0;
  border-bottom-left-radius:0;
  border-left:0;
}

</style>